﻿using System;
using System.Collections.Generic;
using System.Text;

using DotSpatial.Map;
using DotSpatial.Drawing;
using DotSpatial.Geometries;




using DotSpatial .Data ;

namespace HuanGis
{
    [Serializable ]
    public class FShapeLayer : FLayer
    {
        public FShapeLayer(string id)
            : base(id)
        {

        }


        #region 公用变化信息
        public IFeatureLayer IFLayer
        {
            get { return (IFeatureLayer)this.ILayer; }
        }

        #endregion


        /// <summary>
        /// 返回当前层的选择feature
        /// </summary>
        /// <returns></returns>
        public List <IFeature > GetSelectionFeatures()
        {
           return  this.IFLayer.Selection.ToFeatureList();
        }
 

        /// <summary>
        /// 用于存储对应的图形
        /// </summary>
        Dictionary<string, FShape> m_Shapes = new Dictionary<string, FShape>();



        /// <summary>
        /// 用于保存当前图形的类型,type将根据子类型来确定
        /// </summary>
      protected  FeatureTypes m_Type;
      protected FeatureSet m_FeatureSet;



        protected  override void BuildLayer()
        {

            base.BuildLayer();

            m_FeatureSet = new FeatureSet(m_Type);

            this.ILayer = this.m_ParenLManager.CurrentMap.Layers.Add (m_FeatureSet);






        }

        /// <summary>
        /// 添加图形
        /// </summary>
        public virtual  void AddShape(FShape  shp)
        { 


        }

        /// <summary>
        /// 大面积添加图形，借此提高添加读写的效率
        /// </summary>
        /// <param name="lstShp"></param>
        public virtual void AddShapeRane(List<FShape> lstShp)
        {
 
        }

        /// <summary>
        /// 去除图形,根据用户的选择去掉某一图形,这一功能提供给了底层的普通shape文件
        /// </summary>
        public virtual void RemoveShape(string id)
        {

 
        }


        /// <summary>
        /// 清空所有图形,实现底层的晴空操作
        /// </summary>
        public virtual void ClearShapes()
        {

           /// this.ILayer.MapFrame.Clear();
 
        }


        /// <summary>
        /// 根据图形的定义绘制变化的部分
        /// </summary>
        protected virtual  void MapShapeToDrawing()
        {


 
        }


    
    }
}
